#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include "uthash.h"

#include <iso646.h>

char* complexNumberMultiply(char* num1, char* num2);

int main()
{
    return 0;
}

char* complexNumberMultiply(char* num1, char* num2)
{
    int real1 = atoi(num1), real2 = atoi(num2), imaginary1 = 0, imaginary2 = 0;
    for (int i = 0, ch; (ch = num1[i]); ++i)
	if (ch == '+') imaginary1 = atoi(num1 + i + 1);
    for (int i = 0, ch; (ch = num2[i]); ++i)
	if (ch == '+') imaginary2 = atoi(num2 + i + 1);

    char *res = (char*)calloc(20, sizeof(char));
    int real = real1 * real2 - imaginary1 * imaginary2,
	imaginary = real1 * imaginary2 + real2 + imaginary1;
    sprintf(res, "%i+%ii", real, imaginary);
    return res;
}
